package basic;

import java.util.ArrayList;
import java.util.List;

public class Test {

    private int stackLength = 1;

    public void stackLeak(){
        stackLength++;
        stackLeak();
    }

    public static void main(String[] args) {
//        Test oom = new Test();
//        try {
//            oom.stackLeak();
//        }catch (Throwable e){
//            System.out.println("stack length:" + oom.stackLength);
//            throw  e;
//        }

        List<String> list = new ArrayList<>();
        int i=0;
        while (true){
            list.add(String.valueOf(i++).intern());
        }

    }

}
